﻿//EnvironmentUpdater interface implementation
//Author: Sam Nagar

//Includes.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

//Begin Implementation.
namespace EnvironmentUpdater
{
    //Class definition.
    public class AirportEnvironmentUpdate : EnvironmentUpdateService
    {
        //Method to report the wind direction and update the UI accordingly.
        public double reportAndUpdateWindDirection(EnvironmentUpdateSystem eSystem)
        {
            //Check data for existence.
            if (eSystem == null)
            {
                throw new ArgumentNullException("eSystem");
            }
            else
            {
                //Add in code to update wind direction on UI.

                return eSystem.eWindSensor.detectAndReturnWindDirection();
            }
        }

        //Method to update all plane locations and update the UI accordingly.
        public void updateAndPostAllPlaneLocations(EnvironmentUpdateSystem eSystem)
        {
            //Check data for existence.
            if (eSystem == null)
            {
                //Throw Exception.
                throw new ArgumentNullException("eSystem");
            }
            else
            {
                //Generate new plane locations.
                eSystem.eRadar.generateNewPlaneLocations();

                //Add logic to post to UI.
            }
        }

        //Method to request the location of a single plane, will add a parameter to identify a plane later. This method probably won't
        //get used as much since the method to update all planes is more useful.
        public void reportSinglePlaneLocation(EnvironmentUpdateSystem eSystem)
        {
            //Check data for existence
            if (eSystem == null)
            {
                //Throw Exception.
                throw new ArgumentNullException("eSystem");
            }
            else
            {
                //Update the plane in the UI.

                //Return information about the plane being requested.
            }
        }
    }
}





/*Old Sample Code


public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public EnvironmentUpdateSystem GetDataUsingDataContract(EnvironmentUpdateSystem composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }
*/